package com.kotasoft.iip.model.insurance;

import java.io.Serializable;
import java.math.BigDecimal;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "I_ORDER_DISTRIBUTION")
@SuppressWarnings("serial")
public class OrderDistribution implements Serializable {

	@Id
	@Column(name = "ID", length = 36)
	protected String id;

	@ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY, optional = false)
	@JoinColumn(name = "ASSET_ID", nullable = false)
	private BaseAsset asset;

	@Column(name = "PERCENT", precision = 18, scale = 5)
	private BigDecimal percent;

	public BaseAsset getAsset() {
		return asset;
	}

	public void setAsset(BaseAsset asset) {
		this.asset = asset;
	}

	public BigDecimal getPercent() {
		return percent;
	}

	public void setPercent(BigDecimal percent) {
		this.percent = percent;
	}

	public OrderDistribution withAsset(BaseAsset asset) {
		this.asset = asset;
		return this;
	}

	public OrderDistribution withPercent(BigDecimal percent) {
		this.percent = percent;
		return this;
	}

}
